const MyPromise = require("../template.js")

/*** 六、链式异常捕获测试 */
function testErrorPropagation() {
  const promise = new MyPromise((resolve) => resolve(1))

  promise
    .then((value) => {
      throw new Error("chain error")
    })
    .then(
      (value) => console.log("6. Fulfilled:", false),
      (reason) => console.log("6. Rejected:", reason.message === "chain error") // 应打印 true
    )
}

testErrorPropagation()
